from django.conf.urls import patterns

import assets.signals

urlpatterns = patterns('assets.views',
  (r'^services/?$', 'services'),
)

urlpatterns += patterns('assets.tests',
  (r'^tests/?$', 'tests'),
  (r'^test/?$', 'test'),
)

urlpatterns += patterns('assets.plugins',
  (r'^plugins/?$', 'index'),
)

urlpatterns += patterns('assets.views',
  #(r'^$', 'index'),
  (r'^user/$', 'user'),
  
  (r'^files/$', 'files'),
  (r'^files/(?P<file_id>\d+)/children/assets/?$', 'file_children_assets'),
  
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/transcode/?$', 'transcode'),  
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/formats/?$', 'destination_formats'), 
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/dependencies/?$', 'dependencies'),
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/metadata/?$', 'metadata'),
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/info/?$', 'info'),
  
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/anvil/?$', 'anvil'),
  
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/parents/?$', 'parents'),
  
  (r'^assets/(?P<as_id>[a-zA-Z0-9]{40})/image/similar/?$', 'image_similar'),
  
  (r'^formats/?$', 'allformats'),
  
  (r'^assets/search/?$', 'search'),
  
  (r'^transcoders/formats/?$', 'transcoders_formats'),
)

urlpatterns += patterns('assets.damnrest',
  (r'^damn/info/?$', 'damn_info'),
  (r'^damn/repositories/(?P<r_id>\d)/scan/?$', 'repositories_scan'),
  (r'^damn/repositories/(?P<r_id>\d)/scan/status/?$', 'repositories_scan_status'),
  
  (r'^damn/files/analyze/?$', 'files_analyze'),
  (r'^damn/files/analyze/status/?$', 'files_analyze_status'),
  
  (r'^damn/assets/transcode/?$', 'assets_transcode'),
  (r'^damn/assets/transcode/status/?$', 'assets_transcode_status')
)



urlpatterns += patterns('assets.files_upload',
  (r'^files/upload/?$', 'upload'),
  (r'^files/aupload/?$', 'ajax_upload'),
  (r'^files/upload/(?P<hash>[a-zA-Z0-9]+)/(?P<subName>[^/]+?)/(?P<format>.+)/transcode/?$', 'transcode'),
  (r'^files/upload/assets/exclude/(?P<hash>[a-zA-Z0-9]+)/(?P<subName>[^/]+?)/(?P<format>.+)/?$', 'assets_exclude'),
  (r'^files/upload/assets/(?P<hash>[a-zA-Z0-9]+)/(?P<subName>[^/]+?)/(?P<format>.+)$', 'asset'),
  (r'^files/upload/files/?$', 'files'),
  (r'^files/upload/relink/?$', 'relink'),
)

from configuration import default_path
#urlpatterns += patterns('', (r'^assets/(?P<path>.*)$', 'django.views.static.serve', {'document_root': default_path()+'assets/'}),)

